import Vue from 'vue'
import Router from 'vue-router'
/* 第一种：导入hello组件 */
//import hello from '../components/demo/hello.vue'

/* 第二种：导入hello组件 */
import hello from '@/components/demo/hello'

/* 导入hello01组件 */
import hello01 from '../components/demo/helloworld.vue'

import testAjax from '../components/demo/testAjax.vue'

import error from '../components/demo/error.vue'

import testLogin from '../components/demo/testLogin.vue'

import testIndex from '../components/demo/testIndex.vue'

import testEmailVlidate from '../components/demo/testEmailVlidate.vue'

import testUpdatePwd from '../components/demo/testUpdatePwd.vue'

import login from '../components/exam/login.vue'
import index from '../components/exam/index.vue'
import welcome from '../components/exam/welcome.vue'
import questionManager from '../components/exam/questionManager.vue'
import paperCreate from '../components/exam/paperCreate.vue'
import ex from '../components/exam/exam.vue'
Vue.use(Router)

export default new Router({
  mode: "history",
  /* 切换到history模式 */
  routes: [{
      path: '/',
      /* 斜杠表示项目默认地址 */
      name: 'hello',
      /*  组件名称，保持名称唯一性 */
      component: hello /* 引入组件的别名*/
    },
    {
      path: "/hello01",
      name: "hello01",
      component: hello01
    },
    {
      path: "/testAjax",
      name: "testAjax",
      component: testAjax
    },
    {
      path: "*",
      /* 星号是通配所有的错误地址 */
      name: "error",
      component: error
    },
    {
      path: "/testLogin",
      name: "testLogin",
      component: testLogin
    },
    {
      path: "/testIndex",
      name: "testIndex",
      component: testIndex
    },
    {
      path: "/testEmailVlidate", //邮箱验证
      name: "testEmailVlidate",
      component: testEmailVlidate
    },
    {
      path: "/testUpdatePwd", //修改密码
      name: "testUpdatePwd",
      component: testUpdatePwd
    },
    {
      path: "/login", //登录
      name: "login",
      component: login
    },
    {
      path: "/ex", //在线考试
      name: "ex",
      component: ex
    },
    {
      path: "/index", //首页
      name: "index",
      meta:{"isLogin":true},//访问这个页面，需要登录才能访问
      redirect:"/welcome",// 默认打开index页面，子路由视图指向的地址
      component: index,
      children: [ //子路由配置
        {
          path: "/welcome",
          meta:{"isLogin":true},
          name: "welcome",
          component: welcome
        },
        {
          path: "questionManager",
          meta:{"isLogin":true},
          name: "questionManager",
          component: questionManager
        },
        {
          path: "paperCreate",
          meta:{"isLogin":true},
          name: "paperCreate",
          component: paperCreate
        }
      ],

    }
  ]

})
